import Mock from 'mockjs'

Mock.mock(`${process.env.VUE_APP_API_BASE_URL}/equipment/list`, 'post', (request) => {
    let {page, pageSize} = JSON.parse(request.body),
        total = 94,
        list = [],
        num = parseInt(total/ pageSize) >= page ? pageSize : total - (pageSize * (page - 1));
    for(let item = 0; item < num; item++) {
        list.push(Mock.mock({
            id: '@id',
            model:  /[A-Z]-[0-9]{9}/,
            imei: /[0-9]{14}/,
            dateTime: '@datetime("yyyy-MM-dd HH:mm")',
            handling: '@cparagraph(0|1)',
            "isHandling|1-2": true
        }))
    }
    return {
        list, total
    }
})